package io.gitee.twoke.generator.engine.impl.persistence.entity.data.impl;

import io.gitee.twoke.generator.engine.impl.cfg.GenerateEngineConfigurationImpl;
import io.gitee.twoke.generator.engine.impl.generate.DataTableColumn;
import io.gitee.twoke.generator.engine.impl.generate.impl.DataTableColumnQueryImpl;
import io.gitee.twoke.generator.engine.impl.persistence.DataTableColumnDataManager;
import io.gitee.twoke.generator.engine.impl.persistence.entity.*;

import java.util.List;

public class MybatisDataTableColumnDataManager extends AbstractDataManager<DataTableColumnEntity> implements DataTableColumnDataManager {

    public MybatisDataTableColumnDataManager(GenerateEngineConfigurationImpl generateEngineConfiguration) {
        super(generateEngineConfiguration);
    }

    @Override
    public Class<? extends DataTableColumnEntity> getManagedEntityClass() {
        return DataTableColumnEntityImpl.class;
    }

    @Override
    public DataTableColumnEntity create() {
        return new DataTableColumnEntityImpl();
    }

    @Override
    public long findDataTableColumnCountByQueryCriteria(DataTableColumnQueryImpl dataTableColumnQuery) {
        return (Long) getDbSqlSession().selectOne("selectDataTableColumnCountByQueryCriteria", dataTableColumnQuery);
    }

    @Override
    public List<DataTableColumn> findDataTableColumnsByQueryCriteria(DataTableColumnQueryImpl dataTableColumnQuery) {
        return   getDbSqlSession().selectList("selectDataTableColumnsByQueryCriteria", dataTableColumnQuery);
    }
}